package com.wh.wisdomsite.xbox.server.manager;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.wh.wisdomsite.xbox.server.listener.RedisMsgPubSubListener;
import com.wh.wisdomsite.xbox.server.thread.SubThread;
import com.wh.wisdomsite.xbox.us.entity.User;
import com.wh.wisdomsite.xbox.us.service.IUserService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * RedisPubSubManager
 * 用于在应用启动时在内存中订阅redis频道
 *
 * @version V1.0
 * @Package: com.wh.wisdomsite.xbox.server.manager
 * @author: 丁奕
 * @date: 2018-09-25 10:44
 * @Copyright 公司版权所有
 * @Company 贵州万华科技有限公司Copyright (c) 2018
 **/
public class RedisPubSubManager extends HttpServlet {

    private static final Log logger = LogFactory.getLog(RedisPubSubManager.class);

    @Override
    public void init(ServletConfig config) {
        logger.debug("================>[RedisPubSubManager]自动加载启动开始.");
        try {
            super.init();
            SubThread subThread = new SubThread();  //订阅者
            subThread.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
        logger.debug("================>[RedisPubSubManager]自动加载启动结束.");
    }
}
